import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import promiseMiddleware from 'redux-promise'
import { createLogger } from 'redux-logger'
import rootReducer from './reducers'

const middlewares = [
  thunkMiddleware,
  promiseMiddleware,
  createLogger()
]

export default function configStore () {
  const store = createStore(
    rootReducer,
    applyMiddleware(...middlewares)
  )
  return store
}
